package com.crazyhat.crazyhat.controller;

import java.util.Arrays;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.crazyhat.crazyhat.attribute.ClubPositionEnum;
import com.crazyhat.crazyhat.attribute.ClubStatusEnum;
import com.crazyhat.crazyhat.attribute.GenderEnum;
import com.crazyhat.crazyhat.attribute.PostPublicScopeEnum;
import com.crazyhat.crazyhat.pojo.ClubCategory;
import com.crazyhat.crazyhat.pojo.Result;





/**
 * 
 */
@RestController
@RequestMapping("/Attribute")
public class AttributeController {

    @Autowired
    private ClubCategory clubCategoryConfig;

    /**
     * 获取社团状态枚举
     * @return
     */
    @GetMapping("/ClubStatusList")
    public Result<List<ClubStatusEnum>> getClubStatusList() {
        
        return Result.success(Arrays.asList(ClubStatusEnum.values()));
    }
    
    @GetMapping("/ClubCategoryList")
    public Result<List<String>> getClubCategoryList() {

        if (clubCategoryConfig.getClubCategoryList()==null) {
            return Result.error("社团类别为空");
        }

        return Result.success(clubCategoryConfig.getClubCategoryList());
    }

    /**
     * 获取社团成员职位枚举
     * @return
     */
    @GetMapping("/ClubPositionList")
    public Result<List<ClubPositionEnum>> getClubPositionList() {
        return Result.success(Arrays.asList(ClubPositionEnum.values()));
    }
    
    /**
     * 获取性别枚举
     * @return
     */
    @GetMapping("/GenderList")
    public Result<List<GenderEnum>> getList() {
        return Result.success(Arrays.asList(GenderEnum.values()));
    }
    
    @GetMapping("/PostPublicScopeList")
    public Result<List<PostPublicScopeEnum>> getPostPublicScopeList() {
        return Result.success(Arrays.asList(PostPublicScopeEnum.values()));
    }
    
}
